<!--
  This template loads for the 'tab.friend-detail' state (app.js)
  'friend' is a $scope variable created in the FriendsCtrl controller (controllers.js)
  The FriendsCtrl pulls data from the Friends service (service.js)
  The Friends service returns an array of friend data
  <uses-permission android:name="android.permission.INTERNET" />
-->
<ion-view view-title="{{order.deviceName}}">
  <ion-nav-bar class="bar-dark">
    <ion-nav-back-button class="button-clear">
      <i class="ion-chevron-left"></i>
    </ion-nav-back-button>
  </ion-nav-bar>
  <ion-content class="padding">
    <div class="list">
      <label class="item item-input">
        <span class="input-label">工单号:</span>
        <input type="text" ng-model="order.id">
      </label>
      <label class="item item-input">
        <span class="input-label">上报人:</span>
        <input type="text" ng-model="order.reporterName">
      </label>
      <label class="item item-input">
        <span class="input-label">故障原因:</span>
        <input type="text" ng-model="order.reason">
      </label>
      <label class="item item-input">
        <span class="input-label">维修意见:</span>
        <input type="text" ng-model="order.resolution">
      </label>
      <span class="input-label">故障图片:</span>
      <div class="row" ng-repeat="image in issueImages" ng-if="$index % 3 === 0">
        <div class="col col-33" ng-if="$index < issueImages.length">
          <img ng-src="{{issueImages[$index]}}" width="100%" />
        </div>
        <div class="col col-33" ng-if="$index + 1 < issueImages.length">
          <img ng-src="{{issueImages[$index + 1]}}" width="100%" />
        </div>
        <div class="col col-33" ng-if="$index + 2 < issueImages.length">
          <img ng-src="{{issueImages[$index + 2]}}" width="100%" />
        </div>
      </div>

      <span class="input-label">维修图片:</span>
      <div class="row" ng-repeat="image in fixImages" ng-if="$index % 3 === 0">
        <div class="col col-33" ng-if="$index < fixImages.length">
          <img ng-src="{{fixImages[$index]}}" width="100%" />
        </div>
        <div class="col col-33" ng-if="$index + 1 < fixImages.length">
          <img ng-src="{{fixImages[$index + 1]}}" width="100%" />
        </div>
        <div class="col col-33" ng-if="$index + 2 < fixImages.length">
          <img ng-src="{{fixImages[$index + 2]}}" width="100%" />
        </div>
      </div>

      <div class="row">
        <div class="col col-50">
          <button class="item button button-block button-balanced" ng-click="confirmOrder();" > 通过 </button>
        </div>
        <div class="col col-50">
          <button class="item button button-block button-balanced" ng-click="resetOrder();" > 返修 </button>
        </div>
      </div>
    </div>
  </ion-content>
</ion-view>
